﻿@ModelType IEnumerable(Of SchoolClick.Database.MENUBAR)
@code
    Dim idDefault = String.Empty
    Dim topMenu = If(ViewBag.MenuParent Is Nothing, String.Empty, ViewBag.MenuParent)
    If Model.Count = 1 Then
        idDefault = Model.SingleOrDefault.ID_MENU
    End If
End Code

<ul data-active="@idDefault">
    @For Each item In Model
        Dim currentItem = item
        'Dim dataTopMenu = currentItem.NOMBRE_MENU.Replace(" "c, "_"c)
        Dim dataTopMenu = If(ViewBag.MenuParent Is Nothing, currentItem.NOMBRE_MENU.Replace(" "c, "_"c), ViewBag.MenuParent)
        
        @<li title="@currentItem.DESCRIPCION" data-top-menu="@dataTopMenu" data-id-menu="@currentItem.ID_MENU" class="@IIf(Not idDefault.Equals(String.Empty), "selected", "") ">
            <a href="@String.Format("/{0}/{1}", String.Format(currentItem.URL_CONTROLLER, dataTopMenu), currentItem.URL_ACTION_NAME)">@currentItem.NOMBRE_MENU</a>
        </li>     
    Next
</ul>
